import { getItem } from '@/utils/componen.ts';
import { useUserStore } from '@/store/index';
//是否有权限
export const permission = (key: string) => {
  const userPermissions = useUserStore().buttons || [];
  if (!!!key) return true; // 如果未传入权限名，不做处理
  // 判断是否有权限
  const hasPermission = Array.isArray(userPermissions) && userPermissions.length > 0 && userPermissions.includes(key);
  if (!hasPermission) {
    return false;
  }
  return true;
};
